(function() {
  var $, getController;
  this.TomatoBreak = {};
  $ = jQuery;
  this.TomatoBreak.ControllerFactory = {
    create: function(element, klass, params) {
      var controller;
      if (params == null) {
        params = {};
      }
      params.el = element;
      controller = new klass(params);
      element.data('controller', controller);
      return controller;
    }
  };
  this.TomatoBreak.changePage = function(page) {
    if ($.mobile.activePage) {
      return $.mobile.changePage(page, {
        changeHash: false
      });
    }
  };
  getController = function(element) {
    return element != null ? element.data('controller') : void 0;
  };
  ($(document)).bind('mobileinit', function() {
    var opt;
    $.mobile.ajaxEnabled = false;
    $.mobile.hashListeningEnabled = false;
    $.mobile.loadingMessage = 'wait';
    opt = $.mobile.page.prototype.options;
    opt.addBackBtn = false;
    opt.degradeInputs.date = 'text';
    ($('#main')).live('pagehide', function(event, ui) {
      var _ref;
      return (_ref = getController(ui.nextPage)) != null ? _ref.activate() : void 0;
    }).live('pageshow', function(event, ui) {
      var _ref;
      return (_ref = getController(ui.prevPage)) != null ? _ref.reset() : void 0;
    });
    return ($(document)).ajaxSend(function() {
      return $.mobile.showPageLoadingMsg();
    }).ajaxStop(function() {
      return $.mobile.hidePageLoadingMsg();
    });
  });
}).call(this);
